#!/usr/bin/env bash


time=`date +"%Y%m%d%H%M%S"`
timeMonthDay=`date +"%Y%m%d"`
localName=`hostname`  # xxxx
out=/root/hmt/dataDisk #输出路径，文件名默认使用一样的名字
mkdir  -p ${out}
localName=`hostname`
#输出的结果： 主机名,文件系统名,磁盘大小,已使用磁盘大小,剩余磁盘大小,磁盘使用率,挂载路径(磁盘存储位置)
df -aH | grep  -v " 0*-" | grep -v "^Filesystem"  | grep  "%" | awk  -F "@" '{print 0 $1 }' | awk  -v locName=${localName} -v timeMD=${timeMonthDay}  -F " " '{print  locName "," timeMD  "," $2 "," $3 "," $4 "," $5 "," $6 }'  > ${out}/disk_${localName}_${time}.txt # xxxx
echo  $time disk_statis.sh

#1）测试1
#[root@qmyzy-caiji-01-bulmvk hmt]# xxxx
#Filesystem                     Size  Used Avail Use% Mounted on
#/dev/mapper/VolGroup-lv_root    53G  5.2G   46G  11% /
#sysfs                             0     0     0    - /sys
#devpts                            0     0     0    - /dev/pts
#tmpfs                           34G   74k   34G   1% /dev/shm
#/dev/vda1                      508M   41M  441M   9% /boot
#/dev/mapper/VolGroup-lv_home    23G  625M   22G   3% /home
#/dev/mapper/VG_DATA-LV_basoft  1.1T   70G  934G   7% /basoft
#none                              0     0     0    - /proc/sys/fs/binfmt_misc

#2）测试2
#过滤 含有0和-的所在行,注意0前面有空格
#[root@qmyzy-caiji-01-bulmvk wgzx]# xxxx
#Filesystem                     Size  Used Avail Use% Mounted on
#/dev/mapper/VolGroup-lv_root    53G  5.2G   46G  11% /
#tmpfs                           34G   74k   34G   1% /dev/shm
#/dev/vda1                      508M   41M  441M   9% /boot
#/dev/mapper/VolGroup-lv_home    23G  625M   22G   3% /home
#/dev/mapper/VG_DATA-LV_basoft  1.1T   70G  934G   7% /basoft

#3）测试3
# xxxx
#[root@qmyzy-caiji-12 hmt]# xxxx
#/dev/mapper/VolGroup-lv_root
# xxxx
#tmpfs                  34G   70k   34G   1% /dev/shm
#/dev/vda1             500M   69M  405M  15% /boot
#/dev/mapper/VolGroup-lv_home
# xxxx
#/dev/mapper/VG_DATA-LV_basoft
# xxxx

#4）测试4
# xxxx
#[root@qmyzy-caiji-12 hmt]# xxxx
# xxxx
#tmpfs                  34G   70k   34G   1% /dev/shm
#/dev/vda1             500M   69M  405M  15% /boot
# xxxx
# xxxx

#5）测试5
# xxxx
#[root@qmyzy-caiji-12 hmt]# xxxx
#0                       53G  5.2G   45G  11% /
#0tmpfs                  34G   70k   34G   1% /dev/shm
#0/dev/vda1             500M   69M  405M  15% /boot
#0                       23G  437M   22G   3% /home
#0                      1.1T  664G  320G  68% /basoft
